<?php
class myActions extends sfActions {
  
  public function preExecute()
  {
     if ($this->actionName != 'login')
        $this->forwardUnless($this->getUser()->isAuthenticated(), 'home', 'login');
  }
  
  public function redirectToReferer($default = '@homepage')
  {
    $referer = $this->getRequest()->getReferer();
    $this->redirect($referer ? $referer : $default);
  }

}
